package cn.com.victorysoft.wellinfo.controller;

import cn.com.victorysoft.wellinfo.domain.LogInterpretationData;
import cn.com.victorysoft.wellinfo.domain.LogInterpretationDataVO;
import cn.com.victorysoft.wellinfo.service.impl.LoggingInterpretationDataService;
import cn.com.victorysoft.ylgl.service.commons.mybatis.paging.bean.DataPaging;
import cn.com.victorysoft.ylgl.service.commons.web.JsonMessage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * 测井解释数据
 */
@Controller
@RequestMapping({"wellBaseInfo/loggingInterpretation"})
public class LoggingInterpretationController {
    private static final Logger logger = LoggerFactory.getLogger(LoggingInterpretationController.class);

    @Resource
    private LoggingInterpretationDataService service;

    public LoggingInterpretationController() {
    }

    @RequestMapping(
            value = {"/list.wet"},
            method = {RequestMethod.GET, RequestMethod.POST}
    )
    public String list() {
        return "wellBaseInfo/loggingInterpretation/list";
    }

    @RequestMapping(
            value = {"/get.wds"},
            method = {RequestMethod.POST,RequestMethod.GET}
    )
    @ResponseBody
    public JsonMessage get(@RequestParam(value="id", required=true) String id) {
        LogInterpretationData entity = this.service.getById(id);
        return (new JsonMessage()).success(entity);
    }

    @RequestMapping(
            value = {"/queryPagingList.wds"},
            method = {RequestMethod.GET, RequestMethod.POST}
    )
    @ResponseBody
    public JsonMessage queryPagingList(@RequestParam(value = "page",required = false) String page,
                                       @RequestParam(value = "rows",required = false) String rows,
                                       @RequestParam(value = "yt",required = false) String yt,
                                       @RequestParam(value = "qk",required = false) String qk,
                                       @RequestParam(value = "dk",required = false) String dk,
                                       @RequestParam(value = "cw",required = false) String cw,
                                       @RequestParam(value = "jh",required = false) String jh) {

        DataPaging<LogInterpretationDataVO> dataPaging =  this.service.queryPagingList(yt,qk,dk,cw,jh, rows,page);
        return (new JsonMessage()).success(dataPaging);
    }

}